forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] GIT: Create tar archives of tree on the fly
Write commit ID to global extended pax header at the beginning of the tar file, if possible. get-tar-commit-id.c is an example program to get the ID back out of such a tar archive. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
- Loading branch information
Rene Scharfe
authored and
Linus Torvalds
committed
Apr 30, 2005
1 parent
0fc65a4
commit 87fec8f
Showing
2 changed files
with
54 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
#define HEADERSIZE 1024 | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
char buffer[HEADERSIZE]; | ||
ssize_t n; | ||
|
||
n = read(0, buffer, HEADERSIZE); | ||
if (n < HEADERSIZE) { | ||
fprintf(stderr, "read error\n"); | ||
return 3; | ||
} | ||
if (buffer[156] != 'g') | ||
return 1; | ||
if (memcmp(&buffer[512], "52 comment=", 11)) | ||
return 1; | ||
n = write(1, &buffer[523], 41); | ||
if (n < 41) { | ||
fprintf(stderr, "write error\n"); | ||
return 2; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters