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

[PATCH] contrib/subtree: Remove --annotate

From
David Greene <greened@obbligato.org>
Date
Jan 5, 2016, 03:05 UTC
Message-ID
<1451963101-4901-2-git-send-email-greened@obbligato.org>
In-Reply-To
<1451963101-4901-1-git-send-email-greened@obbligato.org>
From: "David A. Greene" <greened@obbligato.org>

Remove --annotate. This obviates the need for an --unannotate command, which is both an obvious addition and difficult to define due to the numerous ways one might want to specify how to edit commit messages. git has other tools more suited to rewriting commit messages and it's easy enough to use them after a subtree split. Such tools include filter-branch, rebase -i and commit --amend.

Signed-off-by: David A. Greene <greened@obbligato.org>
---
 contrib/subtree/git-subtree.sh     |  6 +----
 contrib/subtree/t/t7900-subtree.sh | 50 +++++++++++++++++++-------------------
 2 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index edf36f8..699c954 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -21,7 +21,6 @@ d             show debug messages
 P,prefix=     the name of the subdir to split out
 m,message=    use the given message as the commit message for the merge commit
  options for 'split'
-annotate=     add a prefix to commit message of new commits
 b,branch=     create a new branch from the split subtree
 ignore-joins  ignore prior --rejoin commits
 onto=         try connecting new tree to an existing one
@@ -43,7 +42,6 @@ command=
 onto=
 rejoin=
 ignore_joins=
-annotate=
 squash=
 message=
 prefix=
@@ -87,8 +85,6 @@ while [ $# -gt 0 ]; do
 	case "$opt" in
 		-q) quiet=1 ;;
 		-d) debug=1 ;;
-		--annotate) annotate="$1"; shift ;;
-		--no-annotate) annotate= ;;
 		-b) branch="$1"; shift ;;
 		-P) prefix="${1%/}"; shift ;;
 		-m) message="$1"; shift ;;
@@ -319,7 +315,7 @@ copy_commit()
 			GIT_COMMITTER_NAME \
 			GIT_COMMITTER_EMAIL \
 			GIT_COMMITTER_DATE
-		(printf "%s" "$annotate"; cat ) |
+		(echo -n ""; cat ) |
 		git commit-tree "$2" $3  # reads the rest of stdin
 	) || die "Can't copy commit $1"
 }
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 751aee3..521c401 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -340,8 +340,8 @@ test_expect_success 'split sub dir/ with --rejoin' '
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
-		git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
+		split_hash=$(git subtree split --prefix="sub dir") &&
+		git subtree split --prefix="sub dir" --rejoin &&
 		check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$split_hash'\''"
 	)
  '
@@ -365,7 +365,7 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
+		git subtree split --prefix="sub dir" --message="Split & rejoin" --rejoin &&
 		check_equal "$(last_commit_message)" "Split & rejoin"
 	)
 '
@@ -389,8 +389,8 @@ test_expect_success 'split "sub dir"/ with --branch' '
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
+		split_hash=$(git subtree split --prefix="sub dir") &&
+		git subtree split --prefix="sub dir" --branch subproj-br &&
 		check_equal "$(git rev-parse subproj-br)" "$split_hash"
 	)
 '
@@ -414,8 +414,8 @@ test_expect_success 'check hash of split' '
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
+		split_hash=$(git subtree split --prefix="sub dir") &&
+		git subtree split --prefix="sub dir" --branch subproj-br &&
 		check_equal "$(git rev-parse subproj-br)" "$split_hash" &&
 		# Check hash of split
 		new_hash=$(git rev-parse subproj-br^2) &&
@@ -500,7 +500,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -512,12 +512,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
@@ -566,7 +566,7 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -578,12 +578,12 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
@@ -631,7 +631,7 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -643,12 +643,12 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
@@ -704,7 +704,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -716,12 +716,12 @@ test_expect_success 'make sure each filename changed exactly once in the entire
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
@@ -785,7 +785,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -797,12 +797,12 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
@@ -835,7 +835,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
 		cd "$subtree_test_count" &&
 		git fetch ./"sub proj" master &&
 		git subtree merge --prefix="sub dir" FETCH_HEAD &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count/sub proj" sub3 &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub3 &&
@@ -847,12 +847,12 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
 	test_create_commit "$subtree_test_count/sub proj" sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	test_create_commit "$subtree_test_count" "sub dir"/main-sub4 &&
 	(
 		cd "$subtree_test_count" &&
-		git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br --rejoin
+		git subtree split --prefix="sub dir" --branch subproj-br --rejoin
 	) &&
 	(
 		cd "$subtree_test_count/sub proj" &&
-- 
2.6.1
Previous: David GreeneNext: Junio C Hamano
Message 2 of 8 in “Remote subtree split --annotate”
  1. Remote subtree split --annotateDavid Greene, Jan 5, 2016
  2. contrib/subtree: Remove --annotateDavid Greene, Jan 5, 2016
  3. Junio C HamanoJan 5, 2016
  4. David A. GreeneJan 5, 2016
  5. Junio C HamanoJan 15, 2016
  6. David A. GreeneJan 17, 2016
  7. Junio C HamanoJan 18, 2016
  8. David A. GreeneJun 28, 2016

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.