Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,14 @@ static char *get_post_index_change_sentinel_name(struct repository *r)
{
struct strbuf path = STRBUF_INIT;
const char *sid = tr2_sid_get();
char *slash = strchr(sid, '/');

/*
* Name is based on top-level SID, so children can indicate that
* the top-level process should run the post-command hook.
*/
if (slash)
*slash = 0;
const char *slash = strchrnul(sid, '/');

/*
* Do not write to hooks directory, as it could be redirected
* somewhere like the source tree.
*/
repo_git_path_replace(r, &path, "info/index-change-%s.snt", sid);
repo_git_path_replace(r, &path, "info/index-change-%.*s.snt",
(int)(slash - sid), sid);

return strbuf_detach(&path, NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion virtualfilesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int is_included_in_virtualfilesystem(const char *pathname, int pathlen)

static void parent_directory_hashmap_add(struct hashmap *map, const char *pattern, const int patternlen)
{
char *slash;
const char *slash;
struct virtualfilesystem *vfs;

/*
Expand Down
Loading