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

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

From
JMJosh Micich <josh.micich@gmail.com>
Date
May 14, 2009, 05:09 UTC
Message-ID
<loom.20090514T050742-791@post.gmane.org>
In-Reply-To
<loom.20090514T050424-673@post.gmane.org>

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@gmail.com>
---
 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
Previous: Josh MicichNext: Junio C Hamano
Message 2 of 16 in “Proposed patch for mktree [0/3]”
  1. Josh MicichMay 14, 2009
  2. 1/3 '--missing' option for mktree: re-added strbuf_release(&p_uq), Updated man pageJosh Micich, May 14, 2009
  3. Junio C HamanoMay 14, 2009
  4. Josh MicichMay 14, 2009
  5. 2/3 added --batch option to mktreeJosh Micich, May 14, 2009
  6. Junio C HamanoMay 14, 2009
  7. Josh MicichMay 14, 2009
  8. Sverre RabbelierMay 14, 2009
  9. Josh MicichMay 14, 2009
  10. 3/3 improved validation of entry type in mktreeJosh Micich, May 14, 2009
  11. Junio C HamanoMay 14, 2009
  12. Josh MicichMay 14, 2009
  13. Josh MicichMay 14, 2009
  14. Jakub NarebskiMay 15, 2009
  15. Josh MicichMay 15, 2009
  16. Junio C HamanoMay 15, 2009

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.