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

Re: is it possible filter the revision history of a single file into another repository?

From
Thomas Jarosch <thomas.jarosch@intra2net.com>
Date
Dec 19, 2008, 13:17 UTC
Message-ID
<200812191417.13147.thomas.jarosch@intra2net.com>
In-Reply-To
<8ec76080812190508v2ef0f982pab66a698f06a80d5@mail.gmail.com>
On Friday, 19. December 2008 14:08:23 Whit Armstrong wrote:
> thanks, Thomas. I could definitely pull from your tree.  seems like
> the path of least resistance to get my repo split.

Here's the patch I use for git 1.6.0.5. According to Junio it has the small drawback of always writing out the index, even if there are no changes.

If you need an updated patch against HEAD, look for Junio's reply to my patch in the list archive.

Enjoy, Thomas

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>

--- git-1.6.0.5/builtin-update-index.c 2008-12-08 02:21:49.000000000 +0100 +++ git-1.6.0.5.index/builtin-update-index.c 2008-12-13 12:43:14.000000000 +0100

@@ -297,6 +297,8 @@ static void read_index_info(int line_ter
 	struct strbuf buf;
 	struct strbuf uq;
 
+	int found_something = 0;
+
 	strbuf_init(&buf, 0);
 	strbuf_init(&uq, 0);
 	while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
@@ -307,6 +309,8 @@ static void read_index_info(int line_ter
 		unsigned long ul;
 		int stage;
 
+		found_something = 1;
+
 		/* This reads lines formatted in one of three formats:
 		 *
 		 * (1) mode         SP sha1          TAB path
@@ -382,6 +386,11 @@ static void read_index_info(int line_ter
 	bad_line:
 		die("malformed index info %s", buf.buf);
 	}
+
+	/* Force creation of empty index - needed by git filter-branch */
+	if (!found_something)
+		active_cache_changed = 1;
+
 	strbuf_release(&buf);
 	strbuf_release(&uq);
 }
Previous: Whit ArmstrongNext: Sverre Rabbelier
Message 7 of 8 in “is it possible filter the revision history of a single file into another repository?”
  1. Whit ArmstrongDec 18, 2008
  2. Thomas JaroschDec 18, 2008
  3. Whit ArmstrongDec 18, 2008
  4. Whit ArmstrongDec 18, 2008
  5. Thomas JaroschDec 19, 2008
  6. Whit ArmstrongDec 19, 2008
  7. Thomas JaroschDec 19, 2008
  8. Sverre RabbelierDec 18, 2008

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.