git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: post-update to stash after push to non-bare current branch

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Jan 19, 2012, 00:32 UTC
Message-ID
<4F1764B9.90907@gmail.com>
In-Reply-To
<7vwr8oljq7.fsf@alter.siamese.dyndns.org>
On 1/18/2012 4:38 PM, Junio C Hamano wrote:
Show 15 quoted lines
> Neal Kreitzinger<nkreitzinger@gmail.com>  writes:
>
>> 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)
>
> Have you checked where in the filesystem hierarchy that script is run
> (hint: pwd)?
>
echo pwd in post-update echoes /path/WORKTREE/.git in git-push stdout.
Show 6 quoted lines
> Also it is unclear why you keep saying "stash". What kind of changes are
> you expecting to be saved to the stash? Will they be changes that are not
> source controlled that you would rather not to see? In other words, after
> running "stash" every time somebody pushes and having accumulated many
> stash entries, when do you plan to pop these stashed changes?
>
good point. rejection of dirty worktree is a cleaner safety.
> I would have expect that such a repository to reject a push if the working
> tree is dirty, and run checkout in post-update, though.
>

'git-checkout -f' works manually, but in post-update hook it leaves behind dirty worktree, ie. index and HEAD match, but worktree still matches HEAD@{1}. This is the same undesired result git-stash and git-reset --hard leave behind when executed in post-update hook.

v/r, neal

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 10 in “post-update to stash after push to non-bare current branch”
  1. Neal KreitzingerJan 18, 2012
  2. Neal KreitzingerJan 18, 2012
  3. Neal KreitzingerJan 18, 2012
  4. Junio C HamanoJan 18, 2012
  5. Neal KreitzingerJan 19, 2012
  6. Junio C HamanoJan 19, 2012
  7. Neal KreitzingerJan 19, 2012
  8. Neal KreitzingerJan 21, 2012
  9. Junio C HamanoJan 21, 2012
  10. Neal KreitzingerJan 21, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.