GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — php-git/example/status.php at develop · libgit2/php-git Expand file tree/ Copy pathstatus.phpMore file actions 68 lines (60 loc) · 1.84 KB / Copy pathstatus.phpFile metadata and controls68 lines (60 loc) · 1.84 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 <?php $repo = git_repository_open("."); $list = git_status_list_new($repo, array( )); $payload = array(); printf("# Changes to be committed:\n"); printf("# (use \"git reset HEAD <file>...\" to unstage)\n"); printf("#\n"); $cnt = git_status_list_entrycount($list); for ($i = 0; $i < $cnt; $i++) { $entry = git_status_byindex($list, $i); $flags = $entry['status']; $stat = getStat($flags); if (is_array($entry['head_to_index'])) { printf("# %15s %s\n", $stat, $entry['head_to_index']['new_file']['path']); } } printf("#\n"); printf("# Changes not staged for commit:\n"); printf("# (use \"git add <file>...\" to update what will be committed)\n"); printf("# (use \"git checkout -- <file>...\" to discard changes in working directory)\n"); printf("#\n"); for ($i = 0; $i < $cnt; $i++) { $entry = git_status_byindex($list, $i); $flags = $entry['status']; $stat = getStat($flags); if (is_array($entry['index_to_workdir'])) { printf("# %15s %s\n", $stat, $entry['index_to_workdir']['new_file']['path']); } } printf("#\n"); function getStat($flags) { $stat = ""; if ($flags & GIT_STATUS_IGNORED) { return; } if ($flags == GIT_STATUS_CURRENT) { return; } if ($flags & GIT_STATUS_INDEX_NEW){ $stat = "new file:"; } if ($flags & GIT_STATUS_WT_NEW) { $stat = "untracked:"; } if ($flags & GIT_STATUS_INDEX_MODIFIED ||$flags & GIT_STATUS_WT_MODIFIED) { $stat = "modified:"; } if ($flags & GIT_STATUS_INDEX_DELETED || $flags & GIT_STATUS_WT_DELETED) { $stat = "deleted:"; } if ($flags & GIT_STATUS_INDEX_RENAMED || $flags & GIT_STATUS_WT_RENAMED) { $stat = "renamed:"; } if ($flags & GIT_STATUS_INDEX_TYPECHANGE || $flags & GIT_STATUS_WT_TYPECHANGE) { $stat = "typechange:"; } return $stat; } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |