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

Re: [PATCH] merge: Preserve ORIG_HEAD if already up-to-date with remote.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2011, 23:14 UTC
Message-ID
<7vy614j99n.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1307950525-8011-2-git-send-email-kunal.gangakhedkar@gmail.com>
Kunal Gangakhedkar <kunal.gangakhedkar@gmail.com> writes:
Show 7 quoted lines
> Do not update ORIG_HEAD ref to current HEAD if the repo is already
> in-sync with the remote.
>
> Otherwise, it becomes difficult to keep track of last set of changes.
>
> With this patch, it's possible to do a diffstat/log for last set of
> changes even after a pull/merge that returns 'Already up-to-date'.

I am not sure what you mean. If you are behind remote A and remote B is behind remote A, i.e.

	You -- (fast forwards) --> B -- (fast forwards) --> A
then you should be able to expect these:
	: point zero
	$ git pull A
        $ git diff/log ORIG_HEAD.. ;# shows how your tree and history
        			    # are updated wrt point zero above
	: point one
	$ git pull B
        $ git diff/log ORIG_HEAD.. ;# shows how your tree and history
        			    # are updated wrt point one above

If your patch is to stop recording ORIG_HEAD for the second "git pull" above, I fail to see how that could be a good change.

If you want to drive "pull" from a script (e.g. cron) and want to have precise control of what happens depending on how HEAD is updated, your script has enough freedom and flexibility to do so before running "pull", I think. E.g.

	. $(git --exec-path)/git-sh-setup
	CURRENT=$(git rev-parse HEAD^0) || die "Eh? No Head?"
        git pull || die "pull fails"
        UPDATED=$(git rev-parse HEAD^0)
        if test "$CURRENT" = "$UPDATED"
        then
		exit 0; # nothing happened
	fi
	git shortlog --no-merges $CURRENT..$UPDATED
        git diff --stat --summary $CURRENT..$UPDATED
Previous: Kunal GangakhedkarNext: Kunal Gangakhedkar
Message 3 of 4 in “Preserve ORIG_HEAD if already up-to-date with remote.”
  1. Preserve ORIG_HEAD if already up-to-date with remote.Kunal Gangakhedkar, Jun 13, 2011
  2. merge: Preserve ORIG_HEAD if already up-to-date with remote.Kunal Gangakhedkar, Jun 13, 2011
  3. Junio C HamanoJun 14, 2011
  4. Kunal GangakhedkarJul 17, 2011

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.