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

[PATCH 1/8] diff-no-index: use diff_tree_setup_paths()

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 8, 2010, 15:50 UTC
Message-ID
<1283961023-4491-2-git-send-email-pclouds@gmail.com>
In-Reply-To
<1283961023-4491-1-git-send-email-pclouds@gmail.com>

diff_options.{paths,nr_paths} will be removed later. Do not modify them directly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 diff-no-index.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/diff-no-index.c b/diff-no-index.c
index ce9e783..e48ab92 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -231,8 +231,9 @@ void diff_no_index(struct rev_info *revs,
 
 	if (prefix) {
 		int len = strlen(prefix);
+		const char *paths[3];
+		memset(paths, 0, sizeof(paths));
 
-		revs->diffopt.paths = xcalloc(2, sizeof(char *));
 		for (i = 0; i < 2; i++) {
 			const char *p = argv[argc - 2 + i];
 			/*
@@ -242,12 +243,12 @@ void diff_no_index(struct rev_info *revs,
 			p = (strcmp(p, "-")
 			     ? xstrdup(prefix_filename(prefix, len, p))
 			     : p);
-			revs->diffopt.paths[i] = p;
+			paths[i] = p;
 		}
+		diff_tree_setup_paths(paths, &revs->diffopt);
 	}
 	else
-		revs->diffopt.paths = argv + argc - 2;
-	revs->diffopt.nr_paths = 2;
+		diff_tree_setup_paths(argv + argc - 2, &revs->diffopt);
 	revs->diffopt.skip_stat_unmatch = 1;
 	if (!revs->diffopt.output_format)
 		revs->diffopt.output_format = DIFF_FORMAT_PATCH;
-- 
1.7.1.rc1.70.g13aff
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 2 of 21 in “en/object-list-with-pathspec v4”
  1. 0/8 en/object-list-with-pathspec v4Nguyễn Thái Ngọc Duy, Sep 8, 2010
  2. 1/8 diff-no-index: use diff_tree_setup_paths()Nguyễn Thái Ngọc Duy, Sep 8, 2010
  3. 2/8 Introduce struct tree_pathspec_listNguyễn Thái Ngọc Duy, Sep 8, 2010
  4. 3/8 tree_entry_interesting(): remove dependency on struct diff_optionsNguyễn Thái Ngọc Duy, Sep 8, 2010
  5. Junio C HamanoSep 14, 2010
  6. Nguyen Thai Ngoc DuySep 14, 2010
  7. Junio C HamanoSep 14, 2010
  8. 4/8 tree-walk: move tree_entry_interesting() from tree-diff.cNguyễn Thái Ngọc Duy, Sep 8, 2010
  9. 5/8 Add testcases showing how pathspecs are ignored with rev-list --objectsNguyễn Thái Ngọc Duy, Sep 8, 2010
  10. Junio C HamanoSep 14, 2010
  11. 6/8 Make rev-list --objects work together with pathspecsNguyễn Thái Ngọc Duy, Sep 8, 2010
  12. 7/8 setup_tree_pathspec(): interpret '^' as negative pathspecNguyễn Thái Ngọc Duy, Sep 8, 2010
  13. Elijah NewrenSep 11, 2010
  14. Nguyen Thai Ngoc DuySep 13, 2010
  15. Junio C HamanoSep 14, 2010
  16. Nguyen Thai Ngoc DuySep 14, 2010
  17. 8/8 tree_entry_interesting(): support negative pathspecNguyễn Thái Ngọc Duy, Sep 8, 2010
  18. Elijah NewrenSep 11, 2010
  19. Junio C HamanoSep 14, 2010
  20. Nguyen Thai Ngoc DuySep 14, 2010
  21. Elijah NewrenSep 11, 2010

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.