Skip to content

Instantly share code, notes, and snippets.

@tanakahx
Created August 29, 2014 16:18
Show Gist options
  • Save tanakahx/2121b1aa0926098539a6 to your computer and use it in GitHub Desktop.
Save tanakahx/2121b1aa0926098539a6 to your computer and use it in GitHub Desktop.
Patch for initial git (e83c5163) to make it to be built successfully with gcc 4.2.1 (x86_64-apple-darwin13.2.0)
diff --git Makefile Makefile
index a6bba79..2dad8ff 100644
--- Makefile
+++ Makefile
@@ -8,7 +8,7 @@ all: $(PROG)
install: $(PROG)
install $(PROG) $(HOME)/bin/
-LIBS= -lssl
+LIBS= -lcrypto -lz
init-db: init-db.o
diff --git init-db.c init-db.c
index 25dc13f..69b8c1c 100644
--- init-db.c
+++ init-db.c
@@ -20,7 +20,7 @@ int main(int argc, char **argv)
if (sha1_dir) {
struct stat st;
if (!stat(sha1_dir, &st) < 0 && S_ISDIR(st.st_mode))
- return;
+ return 1;
fprintf(stderr, "DB_ENVIRONMENT set to bad directory %s: ", sha1_dir);
}
diff --git show-diff.c show-diff.c
index b852288..237c230 100644
--- show-diff.c
+++ show-diff.c
@@ -11,11 +11,9 @@ static int match_stat(struct cache_entry *ce, struct stat *st)
{
unsigned int changed = 0;
- if (ce->mtime.sec != (unsigned int)st->st_mtim.tv_sec ||
- ce->mtime.nsec != (unsigned int)st->st_mtim.tv_nsec)
+ if (ce->mtime.sec != (unsigned int)st->st_mtime)
changed |= MTIME_CHANGED;
- if (ce->ctime.sec != (unsigned int)st->st_ctim.tv_sec ||
- ce->ctime.nsec != (unsigned int)st->st_ctim.tv_nsec)
+ if (ce->ctime.sec != (unsigned int)st->st_ctime)
changed |= CTIME_CHANGED;
if (ce->st_uid != (unsigned int)st->st_uid ||
ce->st_gid != (unsigned int)st->st_gid)
diff --git update-cache.c update-cache.c
index 5085a5c..04c7cbe 100644
--- update-cache.c
+++ update-cache.c
@@ -139,9 +139,7 @@ static int add_file_to_cache(char *path)
memset(ce, 0, size);
memcpy(ce->name, path, namelen);
ce->ctime.sec = st.st_ctime;
- ce->ctime.nsec = st.st_ctim.tv_nsec;
ce->mtime.sec = st.st_mtime;
- ce->mtime.nsec = st.st_mtim.tv_nsec;
ce->st_dev = st.st_dev;
ce->st_ino = st.st_ino;
ce->st_mode = st.st_mode;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment