summaryrefslogtreecommitdiff
path: root/index.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-11-23 13:28:53 -0800
committerJunio C Hamano <gitster@pobox.com>2011-11-23 13:28:53 -0800
commit3686aa1caf907d22fe318c28efe93f0e7870ba50 (patch)
treef99a303bd14c7343be7ccc5b9df5382f1bf79246 /index.c
parentaa2577a9c3bd5559bd580feca6edec4d70254adc (diff)
parent1e501a7c47ad5ada53d3b1acfb9f131f76e969ec (diff)
downloadgit-tj/maint-imap-send-remove-unused.tar.gz
Merge branch 'maint' into tj/imap-send-remove-unusedtj/maint-imap-send-remove-unused
* maint: (18123 commits) documentation fix: git difftool uses diff tools, not merge tools. Git 1.7.7.4 Makefile: add missing header file dependencies notes merge: eliminate OUTPUT macro mailmap: xcalloc mailmap_info name-rev --all: do not even attempt to describe non-commit object Git 1.7.7.3 docs: Update install-doc-quick docs: don't mention --quiet or --exit-code in git-log(1) Git 1.7.7.2 t7511: avoid use of reserved filename on Windows. clone: Quote user supplied path in a single quote pair read-cache.c: fix index memory allocation make the sample pre-commit hook script reject names with newlines, too Reindent closing bracket using tab instead of spaces Git 1.7.7.1 RelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting gitweb: fix regression when filtering out forks Almost ready for 1.7.7.1 pack-objects: don't traverse objects unnecessarily ... Conflicts: imap-send.c
Diffstat (limited to 'index.c')
-rw-r--r--index.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/index.c b/index.c
deleted file mode 100644
index f92b960ae4..0000000000
--- a/index.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2005, Junio C Hamano
- */
-#include <signal.h>
-#include "cache.h"
-
-static struct cache_file *cache_file_list;
-
-static void remove_lock_file(void)
-{
- while (cache_file_list) {
- if (cache_file_list->lockfile[0])
- unlink(cache_file_list->lockfile);
- cache_file_list = cache_file_list->next;
- }
-}
-
-static void remove_lock_file_on_signal(int signo)
-{
- remove_lock_file();
- signal(SIGINT, SIG_DFL);
- raise(signo);
-}
-
-int hold_index_file_for_update(struct cache_file *cf, const char *path)
-{
- int fd;
- sprintf(cf->lockfile, "%s.lock", path);
- fd = open(cf->lockfile, O_RDWR | O_CREAT | O_EXCL, 0666);
- if (fd >=0 && !cf->next) {
- cf->next = cache_file_list;
- cache_file_list = cf;
- signal(SIGINT, remove_lock_file_on_signal);
- atexit(remove_lock_file);
- }
- return fd;
-}
-
-int commit_index_file(struct cache_file *cf)
-{
- char indexfile[PATH_MAX];
- int i;
- strcpy(indexfile, cf->lockfile);
- i = strlen(indexfile) - 5; /* .lock */
- indexfile[i] = 0;
- i = rename(cf->lockfile, indexfile);
- cf->lockfile[0] = 0;
- return i;
-}
-
-void rollback_index_file(struct cache_file *cf)
-{
- if (cf->lockfile[0])
- unlink(cf->lockfile);
- cf->lockfile[0] = 0;
-}
-