-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new command, git-write-blob, is introduced. This registers the contents of any file on the filesystem as a blob in the object database and reports its SHA1 to the standard output. To implement it, the patch promotes index_fd() from a static function in update-cache.c to extern and moves it to a library source, sha1_file.c. This command is used to update git-merge-one-file-script so that it does not smudge the work tree. Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Junio C Hamano
committed
May 2, 2005
1 parent
285bf83
commit 74400e7
Showing
5 changed files
with
79 additions
and
52 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
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
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
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
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,25 @@ | ||
/* | ||
* GIT - The information manager from hell | ||
* | ||
* Copyright (C) Linus Torvalds, 2005 | ||
*/ | ||
#include "cache.h" | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int i; | ||
|
||
for (i = 1 ; i < argc; i++) { | ||
char *path = argv[i]; | ||
int fd; | ||
struct stat st; | ||
unsigned char sha1[20]; | ||
fd = open(path, O_RDONLY); | ||
if (fd < 0 || | ||
fstat(fd, &st) < 0 || | ||
index_fd(sha1, fd, &st) < 0) | ||
die("Unable to add blob %s to database", path); | ||
printf("%s\n", sha1_to_hex(sha1)); | ||
} | ||
return 0; | ||
} |