[PATCH 1/3] '--missing' option for mktree: re-added strbuf_release(&p_uq), Updated man page

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

 



Re-added call to strbuf_release(&p_uq) that got lost in earlier changes.
Updated mktree_usage msg.

Updated man page to explain new '--missing' option.
Also clarified sorting behaviour.

Signed-off-by: Josh Micich <josh.micich@xxxxxxxxx>
---
 Documentation/git-mktree.txt |   11 ++++++++---
 builtin-mktree.c             |    5 ++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-mktree.txt b/Documentation/git-mktree.txt
index af19f06..0461062 100644
--- a/Documentation/git-mktree.txt
+++ b/Documentation/git-mktree.txt
@@ -8,18 +8,23 @@ git-mktree - Build a tree-object from ls-tree formatted text
 
 SYNOPSIS
 --------
-'git mktree' [-z]
+'git mktree' [-z] [--missing]
 
 DESCRIPTION
 -----------
-Reads standard input in non-recursive `ls-tree` output format,
-and creates a tree object.  The object name of the tree object
+Reads standard input in non-recursive `ls-tree` output format, and creates
+a tree object.  The order of the tree entries is normalised by mktree so
+pre-sorting the input is not required.  The object name of the tree object
 built is written to the standard output.
 
 OPTIONS
 -------
 -z::
 	Read the NUL-terminated `ls-tree -z` output instead.
+--missing::
+	Allow missing objects.  The default behaviour (without this option)
+	is to verify that each tree entry's sha1 identifies an existing
+	object.
 
 Author
 ------
diff --git a/builtin-mktree.c b/builtin-mktree.c
index e1c9a27..db647ce 100644
--- a/builtin-mktree.c
+++ b/builtin-mktree.c
@@ -63,7 +63,7 @@ static void write_tree(unsigned char *sha1)
 }
 
 static const char *mktree_usage[] = {
-	"git mktree [-z]",
+	"git mktree [-z] [--missing]",
 	NULL
 };
 
@@ -112,6 +112,9 @@ static void mktree_line(char *buf, size_t len, int 
line_termination, int allow_m
 		if (unquote_c_style(&p_uq, path, NULL))
 			die("invalid quoting");
 		path = strbuf_detach(&p_uq, NULL);
+		append_to_tree(mode, sha1, path);
+		strbuf_release(&p_uq);
+		return;
 	}
 	append_to_tree(mode, sha1, path);
 }
-- 
1.6.3.165.g2cce5.dirty



--
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]