All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: git@vger.kernel.org
Subject: [PATCH] Prevent --index-info from ignoring -z.
Date: Thu, 2 Mar 2006 12:21:33 -0500	[thread overview]
Message-ID: <20060302172133.GA19111@spearce.org> (raw)

If git-update-index --index-info -z is used only the first
record given to the process will actually be updated as
the -z option is ignored until after all index records
have been read and processed.  This meant that multiple
null terminated records were seen as a single record which
was lacking a trailing LF, however since the first record
ended in a null the C string handling functions ignored the
trailing garbage.  So --index-info should be required to be
the last command line option, much as --stdin is required
to be the last command line option.  Because --index-info
implies --stdin this isn't an issue as the user shouldn't
be passing --stdin when also passing --index-info.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

---

 update-index.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

base eab8a06b5f0937ead199cbd35950a213486f34eb
last 77565623e6c7a02ead3d080816c761da85421781
diff --git a/update-index.c b/update-index.c
index ce1db38..797245a 100644
--- a/update-index.c
+++ b/update-index.c
@@ -577,9 +577,11 @@ int main(int argc, const char **argv)
 				break;
 			}
 			if (!strcmp(path, "--index-info")) {
+				if (i != argc - 1)
+					die("--index-info must be at the end");
 				allow_add = allow_replace = allow_remove = 1;
 				read_index_info(line_termination);
-				continue;
+				break;
 			}
 			if (!strcmp(path, "--ignore-missing")) {
 				not_new = 1;
-- 
1.2.3.g5f0e

                 reply	other threads:[~2006-03-02 17:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060302172133.GA19111@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.