All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neal Kreitzinger <nkreitzinger@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Neal Kreitzinger <neal@rsss.com>, git@vger.kernel.org
Subject: Re: post-update to stash after push to non-bare current branch
Date: Wed, 18 Jan 2012 12:51:25 -0600	[thread overview]
Message-ID: <4F1714AD.4090706@gmail.com> (raw)
In-Reply-To: <4F171088.4080006@gmail.com>

On 1/18/2012 12:33 PM, Neal Kreitzinger wrote:
> On 1/18/2012 11:53 AM, Neal Kreitzinger wrote:
>> We use the worktree of git-repos as the webroot for virtual hosts
>> assigned
>> to ports so we can directly test changes to dev and test git-repos. We
>> have
>> some developers who want to develop offline on laptops and push to these
>> non-bare repos so they can test their changes. My plan is to set
>> receive.denyCurrentBranch = warn, and then use the post-update hook on
>> the
>> remote non-bare to do a stash of the worktree and index. My assumption is
>> that post-update hook only executes after a successful push. Correct? I
>> only want to stash the non-bare remote work-tree and index after a
>> successful push to it (effectively doing a git-reset --hard, but also
>> keeping any changes to the worktree/index of the non-bare remote as a
>> safety
>> in case someone does directly make uncommitted changes on the non-bare
>> remote.)
>>
> If I manually run git-stash on the non-bare remote after pushing to it
> from a clone (receive.denyCurrentBranch=warn) it works as expected and
> leaves the worktree and index matching the new HEAD. However, when
> post-update runs the git-stash is leaves the worktree dirty. (git 1.7.1)
>
hooks/post-update was:

git stash save
echo "worktree+index of non-bare remote current branch stashed for safety"

it created the stash and echoed the message. However, as stated earlier, 
the worktree is still dirty.  I then manually run git-reset --hard and 
that makes it clean (worktree, index, HEAD match).  However, if I add 
that to the hook it still leaves dirty worktree (index matches HEAD, but 
worktree doesn't match index)

hooks/post-update is:

git stash save
echo "worktree+index of non-bare remote current branch stashed for safety"
git reset --hard
echo "git-reset --hard on current remote branch to ensure clean state"

message is echoed, but git-reset --hard does not appear to have really 
worked. (git 1.7.1)

v/r,
neal

  reply	other threads:[~2012-01-18 18:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 17:53 post-update to stash after push to non-bare current branch Neal Kreitzinger
2012-01-18 18:33 ` Neal Kreitzinger
2012-01-18 18:51   ` Neal Kreitzinger [this message]
2012-01-18 22:38     ` Junio C Hamano
2012-01-19  0:32       ` Neal Kreitzinger
2012-01-19  1:00         ` Junio C Hamano
2012-01-19 21:48           ` Neal Kreitzinger
2012-01-21  0:13             ` Neal Kreitzinger
2012-01-21  0:16               ` Junio C Hamano
2012-01-21  0:35                 ` Neal Kreitzinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F1714AD.4090706@gmail.com \
    --to=nkreitzinger@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=neal@rsss.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.