{"action":"created","issue":{"url":"https://api.github.com/repos/gittup/tup/issues/235","labels_url":"https://api.github.com/repos/gittup/tup/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/gittup/tup/issues/235/comments","events_url":"https://api.github.com/repos/gittup/tup/issues/235/events","html_url":"https://github.com/gittup/tup/issues/235","id":76240694,"number":235,"title":"Generated .gitignore should always use forward slashes","user":{"login":"gavinpc","id":2364221,"avatar_url":"https://avatars.githubusercontent.com/u/2364221?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinpc","html_url":"https://github.com/gavinpc","followers_url":"https://api.github.com/users/gavinpc/followers","following_url":"https://api.github.com/users/gavinpc/following{/other_user}","gists_url":"https://api.github.com/users/gavinpc/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinpc/subscriptions","organizations_url":"https://api.github.com/users/gavinpc/orgs","repos_url":"https://api.github.com/users/gavinpc/repos","events_url":"https://api.github.com/users/gavinpc/events{/privacy}","received_events_url":"https://api.github.com/users/gavinpc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-14T05:37:25Z","updated_at":"2015-11-24T06:45:03Z","closed_at":null,"body":"Even on Windows.  The `.gitignore` generated by Tup on Windows uses backslashes instead of forward slashes.  Following is the `.gitignore` from a little test project:\r\n\r\n    ##### TUP GITIGNORE #####\r\n    ##### Lines below automatically generated by Tup.\r\n    ##### Do not edit.\r\n    .tup\r\n    \\.gitignore\r\n    \\out\r\n\r\nNotwithstanding the slash-related issues elsewhere in Tup for Windows (especially for cygwin users), this one is straightforward: git recognizes (and indeed specifies) forward slashes in the ignore file on all platforms.\r\n\r\nMeanwhile, the above gives incorrect results.  For instance, if I have an `out` folder elsewhere in the project (besides the root), it will be ignored.\r\n"},"comment":{"url":"https://api.github.com/repos/gittup/tup/issues/comments/159171216","html_url":"https://github.com/gittup/tup/issues/235#issuecomment-159171216","issue_url":"https://api.github.com/repos/gittup/tup/issues/235","id":159171216,"user":{"login":"naudhr","id":798574,"avatar_url":"https://avatars.githubusercontent.com/u/798574?v=3","gravatar_id":"","url":"https://api.github.com/users/naudhr","html_url":"https://github.com/naudhr","followers_url":"https://api.github.com/users/naudhr/followers","following_url":"https://api.github.com/users/naudhr/following{/other_user}","gists_url":"https://api.github.com/users/naudhr/gists{/gist_id}","starred_url":"https://api.github.com/users/naudhr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naudhr/subscriptions","organizations_url":"https://api.github.com/users/naudhr/orgs","repos_url":"https://api.github.com/users/naudhr/repos","events_url":"https://api.github.com/users/naudhr/events{/privacy}","received_events_url":"https://api.github.com/users/naudhr/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T06:45:03Z","updated_at":"2015-11-24T06:45:03Z","body":"A simple patch would be enough to address this issue:\r\n```patch\r\ndiff --git a/src/tup/db.c b/src/tup/db.c\r\nindex 4ed1bd1..6074a83 100644\r\n--- a/src/tup/db.c\r\n+++ b/src/tup/db.c\r\n@@ -2476,7 +2476,7 @@ static int get_generated_nodelist(char *dest, tupid_t dt, int *total_len)\r\n \t\t\trc = -1;\r\n \t\t\tgoto out_reset;\r\n \t\t}\r\n-\t\t*p = PATH_SEP;\r\n+\t\t*p = '/'; // .gitignore format requires forward slashes\r\n \t\tp++;\r\n \t\tlen = sqlite3_column_int(*stmt, 0);\r\n \t\tmemcpy(p, sqlite3_column_text(*stmt, 1), len)\r\n```\r\nHowever, the function stack called to generate a gitignore entry looks like\r\n```\r\n*p = PATH_SEP;\r\nget_generated_nodelist()\r\ntup_db_alloc_generated_nodelist()\r\ngitignore()\r\n```\r\nAnd it is unclear from the names of the underlying functions that they are only used for gitignore tasks (though currently they are).\r\nSo, either the names should be amended in favour of smth like `get_generated_nodelist_for_gitignore()` or the separator symbol must be a parameter, in the case the `tup_db_alloc_generated_nodelist()` will some day be used for some other purposes."}}