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

[PATCH] Add -d flag to git-pull-* family.

From
Junio C Hamano <junkio@cox.net>
Date
Jun 1, 2005, 08:24 UTC
Message-ID
<7vu0kilc21.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<7vacmapo18.fsf@assigned-by-dhcp.cox.net>

When a remote repository is deltified, we need to get the objects that a deltified object we want to obtain is based upon. Since checking representation type of all objects we retreive from remote side may be costly, this is made into a separate option -d; -a implies it for convenience and safety.

Rsync transport does not have this problem since it fetches everything the remote side has.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

Documentation/git-http-pull.txt | 4 +++- Documentation/git-local-pull.txt | 4 +++- Documentation/git-rpull.txt | 4 +++- http-pull.c | 5 ++++- local-pull.c | 5 ++++- pull.c | 15 +++++++++++++++ pull.h | 3 +++ rpull.c | 5 ++++- 8 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-http-pull.txt b/Documentation/git-http-pull.txt
--- a/Documentation/git-http-pull.txt
+++ b/Documentation/git-http-pull.txt
@@ -9,7 +9,7 @@ git-http-pull - Downloads a remote GIT r
 
 SYNOPSIS
 --------
-'git-http-pull' [-c] [-t] [-a] [-v] commit-id url
+'git-http-pull' [-c] [-t] [-a] [-v] [-d] commit-id url
 
 DESCRIPTION
 -----------
@@ -17,6 +17,8 @@ Downloads a remote GIT repository via HT
 
 -c::
 	Get the commit objects.
+-d::
+	Get objects that deltified objects are based upon.
 -t::
 	Get trees associated with the commit objects.
 -a::
diff --git a/Documentation/git-local-pull.txt b/Documentation/git-local-pull.txt
--- a/Documentation/git-local-pull.txt
+++ b/Documentation/git-local-pull.txt
@@ -9,7 +9,7 @@ git-local-pull - Duplicates another GIT 
 
 SYNOPSIS
 --------
-'git-local-pull' [-c] [-t] [-a] [-l] [-s] [-n] [-v] commit-id path
+'git-local-pull' [-c] [-t] [-a] [-l] [-s] [-n] [-v] [-d] commit-id path
 
 DESCRIPTION
 -----------
@@ -19,6 +19,8 @@ OPTIONS
 -------
 -c::
 	Get the commit objects.
+-d::
+	Get objects that deltified objects are based upon.
 -t::
 	Get trees associated with the commit objects.
 -a::
diff --git a/Documentation/git-rpull.txt b/Documentation/git-rpull.txt
--- a/Documentation/git-rpull.txt
+++ b/Documentation/git-rpull.txt
@@ -10,7 +10,7 @@ git-rpull - Pulls from a remote reposito
 
 SYNOPSIS
 --------
-'git-rpull' [-c] [-t] [-a] [-v] commit-id url
+'git-rpull' [-c] [-t] [-a] [-v] [-d] commit-id url
 
 DESCRIPTION
 -----------
@@ -21,6 +21,8 @@ OPTIONS
 -------
 -c::
 	Get the commit objects.
+-d::
+	Get objects that deltified objects are based upon.
 -t::
 	Get trees associated with the commit objects.
 -a::
diff --git a/http-pull.c b/http-pull.c
--- a/http-pull.c
+++ b/http-pull.c
@@ -103,17 +103,20 @@ int main(int argc, char **argv)
 			get_tree = 1;
 		} else if (argv[arg][1] == 'c') {
 			get_history = 1;
+		} else if (argv[arg][1] == 'd') {
+			get_delta = 1;
 		} else if (argv[arg][1] == 'a') {
 			get_all = 1;
 			get_tree = 1;
 			get_history = 1;
+			get_delta = 1;
 		} else if (argv[arg][1] == 'v') {
 			get_verbosely = 1;
 		}
 		arg++;
 	}
 	if (argc < arg + 2) {
-		usage("git-http-pull [-c] [-t] [-a] [-v] commit-id url");
+		usage("git-http-pull [-c] [-t] [-a] [-d] [-v] commit-id url");
 		return 1;
 	}
 	commit_id = argv[arg];
diff --git a/local-pull.c b/local-pull.c
--- a/local-pull.c
+++ b/local-pull.c
@@ -74,7 +74,7 @@ int fetch(unsigned char *sha1)
 }
 
 static const char *local_pull_usage = 
-"git-local-pull [-c] [-t] [-a] [-l] [-s] [-n] [-v] commit-id path";
+"git-local-pull [-c] [-t] [-a] [-l] [-s] [-n] [-v] [-d] commit-id path";
 
 /* 
  * By default we only use file copy.
@@ -92,10 +92,13 @@ int main(int argc, char **argv)
 			get_tree = 1;
 		else if (argv[arg][1] == 'c')
 			get_history = 1;
+		else if (argv[arg][1] == 'd')
+			get_delta = 1;
 		else if (argv[arg][1] == 'a') {
 			get_all = 1;
 			get_tree = 1;
 			get_history = 1;
+			get_delta = 1;
 		}
 		else if (argv[arg][1] == 'l')
 			use_link = 1;
diff --git a/pull.c b/pull.c
--- a/pull.c
+++ b/pull.c
@@ -6,6 +6,7 @@
 
 int get_tree = 0;
 int get_history = 0;
+int get_delta = 0;
 int get_all = 0;
 int get_verbosely = 0;
 static unsigned char current_commit_sha1[20];
@@ -37,6 +38,20 @@ static int make_sure_we_have_it(const ch
 	status = fetch(sha1);
 	if (status && what)
 		report_missing(what, sha1);
+	if (get_delta) {
+		unsigned long mapsize, size;
+		void *map, *buf;
+		char type[20];
+
+		map = map_sha1_file(sha1, &mapsize);
+		if (map) {
+			buf = unpack_sha1_file(map, mapsize, type, &size);
+			munmap(map, mapsize);
+			if (buf && !strcmp(type, "delta"))
+				status = make_sure_we_have_it(what, buf);
+			free(buf);
+		}
+	}
 	return status;
 }
 
diff --git a/pull.h b/pull.h
--- a/pull.h
+++ b/pull.h
@@ -13,6 +13,9 @@ extern int get_history;
 /** Set to fetch the trees in the commit history. **/
 extern int get_all;
 
+/* Set to fetch the base of delta objects.*/
+extern int get_delta;
+
 /* Set to be verbose */
 extern int get_verbosely;
 
diff --git a/rpull.c b/rpull.c
--- a/rpull.c
+++ b/rpull.c
@@ -27,17 +27,20 @@ int main(int argc, char **argv)
 			get_tree = 1;
 		} else if (argv[arg][1] == 'c') {
 			get_history = 1;
+		} else if (argv[arg][1] == 'd') {
+			get_delta = 1;
 		} else if (argv[arg][1] == 'a') {
 			get_all = 1;
 			get_tree = 1;
 			get_history = 1;
+			get_delta = 1;
 		} else if (argv[arg][1] == 'v') {
 			get_verbosely = 1;
 		}
 		arg++;
 	}
 	if (argc < arg + 2) {
-		usage("git-rpull [-c] [-t] [-a] [-v] commit-id url");
+		usage("git-rpull [-c] [-t] [-a] [-v] [-d] commit-id url");
 		return 1;
 	}
 	commit_id = argv[arg];
------------------------------------------------
Previous: Junio C HamanoNext: Nicolas Pitre
Message 5 of 64 in “I want to release a "git-1.0"”
  1. Linus TorvaldsMay 30, 2005
  2. jeff millarMay 30, 2005
  3. Nicolas PitreMay 30, 2005
  4. Junio C HamanoJun 1, 2005
  5. Add -d flag to git-pull-* family.Junio C Hamano, Jun 1, 2005
  6. Nicolas PitreJun 1, 2005
  7. Junio C HamanoJun 1, 2005
  8. Junio C HamanoMay 30, 2005
  9. Junio C HamanoMay 30, 2005
  10. David GreavesMay 30, 2005
  11. Dave JonesMay 30, 2005
  12. Dmitry TorokhovMay 30, 2005
  13. Junio C HamanoMay 30, 2005
  14. Dmitry TorokhovMay 30, 2005
  15. Linus TorvaldsMay 31, 2005
  16. Ryan AndersonMay 30, 2005
  17. Linus TorvaldsMay 31, 2005
  18. Chris WedgwoodMay 30, 2005
  19. Chris WedgwoodMay 30, 2005
  20. Linus TorvaldsMay 31, 2005
  21. Junio C HamanoJun 1, 2005
  22. David LangJun 1, 2005
  23. Junio C HamanoJun 1, 2005
  24. David LangJun 1, 2005
  25. C. Scott AnanianJun 1, 2005
  26. Nicolas PitreJun 2, 2005
  27. Brian O'MahoneyJun 2, 2005
  28. Junio C HamanoJun 1, 2005
  29. Petr BaudisMay 31, 2005
  30. Eric W. BiedermanMay 31, 2005
  31. Linus TorvaldsJun 1, 2005
  32. Junio C HamanoJun 1, 2005
  33. Fix -B "very-different" logic.Junio C Hamano, Jun 2, 2005
  34. Linus TorvaldsJun 3, 2005
  35. Junio C HamanoJun 3, 2005
  36. 0/4 Fix -B "very-different" logic.Junio C Hamano, Jun 3, 2005
  37. 1/4 Tweak count-delta interfaceJunio C Hamano, Jun 3, 2005
  38. 2/4 diff: Fix docs and add -O to diff-helper.Junio C Hamano, Jun 3, 2005
  39. 3/4 diff: Clean up diff_scoreopt_parse().Junio C Hamano, Jun 3, 2005
  40. 4/4 diff: Update -B heuristics.Junio C Hamano, Jun 3, 2005
  41. Junio C HamanoJun 1, 2005
  42. Daniel BarkalowJun 1, 2005
  43. Junio C HamanoJun 1, 2005
  44. Petr BaudisJun 3, 2005
  45. Daniel BarkalowJun 3, 2005
  46. Eric W. BiedermanJun 2, 2005
  47. Kay SieversJun 2, 2005
  48. Linus TorvaldsJun 2, 2005
  49. several typos in tutorialAlexey Nezhdanov, Jun 2, 2005
  50. Vincent HanquezJun 2, 2005
  51. Alexey NezhdanovJun 2, 2005
  52. Vincent HanquezJun 2, 2005
  53. Alexey NezhdanovJun 2, 2005
  54. Alexey NezhdanovJun 2, 2005
  55. Adam KropelinJun 2, 2005
  56. Linus TorvaldsJun 3, 2005
  57. Linus TorvaldsJun 3, 2005
  58. Adam KropelinJun 3, 2005
  59. CVS migration section to the tutorial.Junio C Hamano, Jun 2, 2005
  60. Nicolas PitreJun 2, 2005
  61. Nicolas PitreJun 2, 2005
  62. Junio C HamanoJun 2, 2005
  63. Linus TorvaldsJun 2, 2005
  64. Junio C HamanoJun 2, 2005

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.