From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH 1/3] diff options: Introduce --ignore-submodules
Date: Wed, 14 May 2008 18:03:31 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.1.00.0805141803240.30431@racer> (raw)
In-Reply-To: <alpine.DEB.1.00.0805141802480.30431@racer>
The new option --ignore-submodules can now be used to ignore changes in
submodules.
Why? Sometimes it is not interesting when a submodule changed.
For example, when reordering some commits in the superproject, a dirty
submodule is usually totally uninteresting. So we will use this option
in git-rebase to test for a dirty working tree.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Documentation/diff-options.txt | 3 +++
diff.c | 9 +++++++++
diff.h | 1 +
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 13234fa..859d679 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -228,6 +228,9 @@ endif::git-format-patch[]
--no-ext-diff::
Disallow external diff drivers.
+--ignore-submodules::
+ Ignore changes to submodules in the diff generation.
+
--src-prefix=<prefix>::
Show the given source prefix instead of "a/".
diff --git a/diff.c b/diff.c
index 439d474..d57bc29 100644
--- a/diff.c
+++ b/diff.c
@@ -2496,6 +2496,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
else if (!strcmp(arg, "--no-ext-diff"))
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
+ else if (!strcmp(arg, "--ignore-submodules"))
+ DIFF_OPT_SET(options, IGNORE_SUBMODULES);
/* misc options */
else if (!strcmp(arg, "-z"))
@@ -3355,6 +3357,9 @@ void diff_addremove(struct diff_options *options,
char concatpath[PATH_MAX];
struct diff_filespec *one, *two;
+ if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(mode))
+ return;
+
/* This may look odd, but it is a preparation for
* feeding "there are unchanged files which should
* not produce diffs, but when you are doing copy
@@ -3399,6 +3404,10 @@ void diff_change(struct diff_options *options,
char concatpath[PATH_MAX];
struct diff_filespec *one, *two;
+ if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(old_mode)
+ && S_ISGITLINK(new_mode))
+ return;
+
if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
unsigned tmp;
const unsigned char *tmp_c;
diff --git a/diff.h b/diff.h
index 3a02d38..1dfe1f9 100644
--- a/diff.h
+++ b/diff.h
@@ -63,6 +63,7 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
#define DIFF_OPT_REVERSE_DIFF (1 << 15)
#define DIFF_OPT_CHECK_FAILED (1 << 16)
#define DIFF_OPT_RELATIVE_NAME (1 << 17)
+#define DIFF_OPT_IGNORE_SUBMODULES (1 << 18)
#define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
#define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags &= ~DIFF_OPT_##flag)
--
1.5.5.1.375.g1becb
next prev parent reply other threads:[~2008-05-14 17:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 17:03 [PATCH 0/3] sane rebase/stash support with submodules Johannes Schindelin
2008-05-14 17:03 ` Johannes Schindelin [this message]
2008-05-14 18:28 ` [PATCH 1/3] diff options: Introduce --ignore-submodules Junio C Hamano
2008-05-14 18:42 ` Johannes Schindelin
2008-05-14 19:17 ` Junio C Hamano
2008-05-14 22:09 ` Johannes Schindelin
2008-05-14 22:12 ` Junio C Hamano
2008-05-15 1:09 ` Johannes Schindelin
2008-05-15 1:50 ` Junio C Hamano
2008-05-15 13:58 ` Johannes Schindelin
2008-05-14 17:03 ` [PATCH 2/3] Teach update-index about --ignore-submodules Johannes Schindelin
2008-05-14 17:03 ` [PATCH 3/3] Ignore dirty submodule states during rebase and stash Johannes Schindelin
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=alpine.DEB.1.00.0805141803240.30431@racer \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox