[PATCH] Put FETCH_HEAD data in merge commit message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This makes git-fetch <URL> && git-merge FETCH_HEAD produce same merge
message as git-pull <URL>

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxxxxxxxxxx>

---

> To reiterate the more important points (this is also for my own
> purpose because I do not want the patch lost in this noise we
> are making):
> 
>  - Checking readability of $GIT_DIR/$remote itself is too loose;
>    the name FETCH_HEAD should explicitly be checked, as that is
>    the file that has the specific format that is understood by
>    fmt-merge-msg.
> 
>  - "echo -n" is to be avoided for portability.
> 
>  - "git fetch $URL foo bar" would leave two lines in FETCH_HEAD;
>    subsequent "git merge FETCH_HEAD" would merge only foo.  Pick
>    the first line, stripping out not-for-merge marker and let it
>    processed by fmt-merge-msg.

Is this OK?

diff --git a/git-merge.sh b/git-merge.sh
index 8759c5a..417bf33 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -108,6 +108,10 @@ merge_name () {
 		git-show-ref -q --verify "refs/heads/$truname" 2>/dev/null
 	then
 		echo "$rh		branch '$truname' (early part) of ."
+	elif test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
+	then
+		sed -e 's/	not-for-merge	/		/' -e 1q\
+	       		"$GIT_DIR/FETCH_HEAD"
 	else
 		echo "$rh		commit '$remote'"
 	fi

-- 
MST
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]