MCPcopy Index your code
hub / github.com/git/git / chdir_notify

Function chdir_notify

chdir-notify.c:72–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int chdir_notify(const char *new_cwd)
73{
74 struct strbuf old_cwd = STRBUF_INIT;
75 struct list_head *pos;
76
77 if (strbuf_getcwd(&old_cwd) < 0)
78 return -1;
79 if (chdir(new_cwd) < 0) {
80 int saved_errno = errno;
81 strbuf_release(&old_cwd);
82 errno = saved_errno;
83 return -1;
84 }
85
86 trace_printf_key(&trace_setup_key,
87 "setup: chdir from '%s' to '%s'",
88 old_cwd.buf, new_cwd);
89
90 list_for_each(pos, &chdir_notify_entries) {
91 struct chdir_notify_entry *e =
92 list_entry(pos, struct chdir_notify_entry, list);
93 e->cb(e->name, old_cwd.buf, new_cwd, e->data);
94 }
95
96 strbuf_release(&old_cwd);
97 return 0;
98}
99
100char *reparent_relative_path(const char *old_cwd,
101 const char *new_cwd,

Callers 1

setup_work_treeFunction · 0.85

Calls 3

strbuf_getcwdFunction · 0.85
chdirFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected