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

Re: [RFC] Silent File Mods Being Committed

From
Junio C Hamano <junkio@cox.net>
Date
Mar 23, 2006, 05:13 UTC
Message-ID
<7vek0t68we.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<E1FMH3o-0001B5-Dw@jdl.com>
Jon Loeliger <jdl@jdl.com> writes:
Show 13 quoted lines
> However, 'git status' didn't show that output....
>
> And that is because it is driven by the diffcore instead!
> So I _think_ diff_resolve_rename_copy() has to be consulted
> to get that DIFF_STATUS_MODIFIED indicator.  Except that it is
> shared with the SHA1 compare too:
>
>                 else if (memcmp(p->one->sha1, p->two->sha1, 20) ||
>                          p->one->mode != p->two->mode)
>                         p->status = DIFF_STATUS_MODIFIED;
>
> But I haven't tracked it back to see how to propagate that
> status back up to show_modified() in diff-files.c yet...
I think the cleanest way would be either
 (1) define another output format to diffcore similar to
     --name-status, let that format perform most of what
     DIFF_FORMAT_NAME_STATUS does, and update
     diff.c:diff_flush_raw() to show the mode change as M+ (old
     was not executable but new is) or M- (the other way); or
 (2) audit all the scripts to make sure they do not get upset if
     we add trailing +/- to the status letter, and do that
     unconditionally, like the attached patch does.
If you go the latter route, you would get something like this:
        $ ./git-diff-files --abbrev
        :100644 100755 c0548ee... 0000000... M+	diff.c
	$ ./git-diff-files --name-status
        M+	diff.c
---
diff --git a/diff.c b/diff.c
index c0548ee..09b8f7e 100644
--- a/diff.c
+++ b/diff.c
@@ -1034,6 +1034,10 @@ static void diff_flush_raw(struct diff_f
 		status[0] = p->status;
 		status[1] = 0;
 	}
+
+	if (p->one->mode && p->two->mode && p->one->mode != p->two->mode)
+		strcat(status, (p->two->mode & 01) ? "+" : "-");
+
 	switch (p->status) {
 	case DIFF_STATUS_COPIED:
 	case DIFF_STATUS_RENAMED:
Previous: Jon LoeligerNext: Petr Baudis
Message 2 of 6 in “[RFC] Silent File Mods Being Committed”
  1. Jon LoeligerMar 23, 2006
  2. Junio C HamanoMar 23, 2006
  3. Petr BaudisMar 23, 2006
  4. Junio C HamanoMar 23, 2006
  5. Junio C HamanoMar 23, 2006
  6. Petr BaudisMar 24, 2006

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.