{"thread":{"id":"37731","subject":"Expected bug with reset --hard","startedAt":"2014-10-15T04:34:12Z","lastAt":"2014-10-15T05:47:51Z","messageCount":2,"participants":["Nicholas Chmielewski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"250662","messageId":"CAEemfuW5k+2r7TpetUK8dh5vLZBR4-Kc1JgYJhG-RPpoQTRQ3Q@mail.gmail.com","threadId":"37731","inReplyTo":null,"subject":"Expected bug with reset --hard","fromName":"Nicholas Chmielewski","fromEmail":"nicholas.chmielewski@ennova.com.au","sentAt":"2014-10-15T04:34:12Z","receivedAt":"2014-10-15T04:34:12Z","isPatch":false,"sender":{"key":"nicholas.chmielewski@ennova.com.au","avatar":null},"body":"git version 1.9.1 & version 2.1.2\n\nI had some changes in a tracked file that I wanted to discard.\nInstead of using checkout, I instead used `git reset --hard HEAD` to reset.\n\nGit returned the message `HEAD is now at <sha> <commit-message>`\nI then went `git status` and it showed me that I still have changes to commit\n\nI expected there to be no changes in my working directory as a result of\ndoing a `git reset --hard`\n\nI did a little more fiddling around and still yielded the same results.\n\n- `$ touch file.md`\n- `$ git add file.md`\n- `$ git commit -m 'empty file'`\n- `$ echo 'text' > file.md`\n\nAt this point git reported that I had uncommited changes for both file.md and\nthe troublesome file in question (jquery.datatables.js)\n\n`$ git reset --hard HEAD`\n\nGit now no longer reports and untracked changes for file.md but still\nfor jquery.datatables.js\n\n`$ git reset --hard HEAD~1`\n\nGit still reports untracked changes for jquery.datatables.js\n\nI have included a copy of the diff of the jquery.datatables.js\n\n\ndiff --git a/vendor/assets/javascripts/jquery.datatables.js b/vendor/assets/javascripts/jquery.datatables.js\nindex b9044f1..4aab04b 100644\n--- a/vendor/assets/javascripts/jquery.datatables.js\n+++ b/vendor/assets/javascripts/jquery.datatables.js\n@@ -1,11 +1,11 @@\n-/*! DataTables 1.10.1\n- * Â©2008-2014 SpryMedia Ltd - datatables.net/license\n+/*! DataTables 1.10.3\n+ * ©2008-2014 SpryMedia Ltd - datatables.net/license\n  */\n \n /**\n  * @summary     DataTables\n  * @description Paginate, search and order HTML tables\n- * @version     1.10.1\n+ * @version     1.10.3\n  * @file        jquery.dataTables.js\n  * @author      SpryMedia Ltd (www.sprymedia.co.uk)\n  * @contact     www.sprymedia.co.uk/contact\n@@ -113,7 +113,7 @@\n \t\n \t// U+2009 is thin space and U+202F is narrow no-break space, both used in many\n \t// standards as thousands separators\n-\tvar _re_formatted_numeric = /[',$Â£â‚¬Â¥%\\u2009\\u202F]/g;\n+\tvar _re_formatted_numeric = /[',$£€¥%\\u2009\\u202F]/g;\n \t\n \t\n \tvar _empty = function ( d ) {\n@@ -133,7 +133,7 @@\n \t\tif ( ! _re_dic[ decimalPoint ] ) {\n \t\t\t_re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' );\n \t\t}\n-\t\treturn typeof num === 'string' ?\n+\t\treturn typeof num === 'string' && decimalPoint !== '.' ?\n \t\t\tnum.replace( /\\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) :\n \t\t\tnum;\n \t};\n@@ -310,7 +310,6 @@\n \t\t\t\tnewKey = key.replace( match[0], match[2].toLowerCase() );\n \t\t\t\tmap[ newKey ] = key;\n \t\n-\t\t\t\t//console.log( key, match );\n \t\t\t\tif ( match[1] === 'o' )\n \t\t\t\t{\n \t\t\t\t\t_fnHungarianMap( o[key] );\n@@ -673,6 +672,12 @@\n \t\t\treturn _fnSetObjectDataFn( mDataSrc )( rowData, val, meta );\n \t\t};\n \t\n+\t\t// Indicate if DataTables should read DOM data as an object or array\n+\t\t// Used in _fnGetRowElements\n+\t\tif ( typeof mDataSrc !== 'number' ) {\n+\t\t\toSettings._rowReadObject = true;\n+\t\t}\n+\t\n \t\t/* Feature sorting overrides column specific when off */\n \t\tif ( !oSettings.oFeatures.bSort )\n \t\t{\n@@ -1498,19 +1503,22 @@\n \tfunction _fnGetRowElements( settings, row )\n \t{\n \t\tvar\n-\t\t\td = [],\n \t\t\ttds = [],\n \t\t\ttd = row.firstChild,\n \t\t\tname, col, o, i=0, contents,\n-\t\t\tcolumns = settings.aoColumns;\n+\t\t\tcolumns = settings.aoColumns,\n+\t\t\tobjectRead = settings._rowReadObject;\n \t\n-\t\tvar attr = function ( str, data, td  ) {\n+\t\tvar d = objectRead ? {} : [];\n+\t\n+\t\tvar attr = function ( str, td  ) {\n \t\t\tif ( typeof str === 'string' ) {\n \t\t\t\tvar idx = str.indexOf('@');\n \t\n \t\t\t\tif ( idx !== -1 ) {\n-\t\t\t\t\tvar src = str.substring( idx+1 );\n-\t\t\t\t\to[ '@'+src ] = td.getAttribute( src );\n+\t\t\t\t\tvar attr = str.substring( idx+1 );\n+\t\t\t\t\tvar setter = _fnSetObjectDataFn( str );\n+\t\t\t\t\tsetter( d, td.getAttribute( attr ) );\n \t\t\t\t}\n \t\t\t}\n \t\t};\n@@ -1520,18 +1528,26 @@\n \t\t\tcontents = $.trim(cell.innerHTML);\n \t\n \t\t\tif ( col && col._bAttrSrc ) {\n-\t\t\t\to = {\n-\t\t\t\t\tdisplay: contents\n-\t\t\t\t};\n+\t\t\t\tvar setter = _fnSetObjectDataFn( col.mData._ );\n+\t\t\t\tsetter( d, contents );\n \t\n-\t\t\t\tattr( col.mData.sort, o, cell );\n-\t\t\t\tattr( col.mData.type, o, cell );\n-\t\t\t\tattr( col.mData.filter, o, cell );\n-\t\n-\t\t\t\td.push( o );\n+\t\t\t\tattr( col.mData.sort, cell );\n+\t\t\t\tattr( col.mData.type, cell );\n+\t\t\t\tattr( col.mData.filter, cell );\n \t\t\t}\n \t\t\telse {\n-\t\t\t\td.push( contents );\n+\t\t\t\t// Depending on the `data` option for the columns the data can be\n+\t\t\t\t// read to either an object or an array.\n+\t\t\t\tif ( objectRead ) {\n+\t\t\t\t\tif ( ! col._setter ) {\n+\t\t\t\t\t\t// Cache the setter function\n+\t\t\t\t\t\tcol._setter = _fnSetObjectDataFn( col.mData );\n+\t\t\t\t\t}\n+\t\t\t\t\tcol._setter( d, contents );\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\td.push( contents );\n+\t\t\t\t}\n \t\t\t}\n \t\n \t\t\ti++;\n@@ -1950,7 +1966,9 @@\n \t\t\t\t\t}\n \t\t\t\t}\n \t\n-\t\t\t\t/* Row callback functions - might want to manipulate the row */\n+\t\t\t\t// Row callback functions - might want to manipulate the row\n+\t\t\t\t// iRowCount and j are not currently documented. Are they at all\n+\t\t\t\t// useful?\n \t\t\t\t_fnCallbackFire( oSettings, 'aoRowCallback', null,\n \t\t\t\t\t[nRow, aoData._aData, iRowCount, j] );\n \t\n@@ -2695,13 +2713,20 @@\n \t\t\t\t_fnDraw( settings );\n \t\t\t}\n \t\t};\n+\t\n+\t\tvar searchDelay = settings.searchDelay !== null ?\n+\t\t\tsettings.searchDelay :\n+\t\t\t_fnDataSource( settings ) === 'ssp' ?\n+\t\t\t\t400 :\n+\t\t\t\t0;\n+\t\n \t\tvar jqFilter = $('input', filter)\n \t\t\t.val( previousSearch.sSearch )\n \t\t\t.attr( 'placeholder', language.sSearchPlaceholder )\n \t\t\t.bind(\n \t\t\t\t'keyup.DT search.DT input.DT paste.DT cut.DT',\n-\t\t\t\t_fnDataSource( settings ) === 'ssp' ?\n-\t\t\t\t\t_fnThrottle( searchFn, 400 ):\n+\t\t\t\tsearchDelay ?\n+\t\t\t\t\t_fnThrottle( searchFn, searchDelay ) :\n \t\t\t\t\tsearchFn\n \t\t\t)\n \t\t\t.bind( 'keypress.DT', function(e) {\n@@ -2924,9 +2949,12 @@\n \t\t\t * ^(?=.*?\\bone\\b)(?=.*?\\btwo three\\b)(?=.*?\\bfour\\b).*$\n \t\t\t */\n \t\t\tvar a = $.map( search.match( /\"[^\"]+\"|[^ ]+/g ) || '', function ( word ) {\n-\t\t\t\treturn word.charAt(0) === '\"' ?\n-\t\t\t\t\tword.match( /^\"(.*)\"$/ )[1] :\n-\t\t\t\t\tword;\n+\t\t\t\tif ( word.charAt(0) === '\"' ) {\n+\t\t\t\t\tvar m = word.match( /^\"(.*)\"$/ );\n+\t\t\t\t\tword = m ? m[1] : word;\n+\t\t\t\t}\n+\t\n+\t\t\t\treturn word.replace('\"', '');\n \t\t\t} );\n \t\n \t\t\tsearch = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';\n@@ -2973,34 +3001,40 @@\n \t\t\t\t\tif ( column.bSearchable ) {\n \t\t\t\t\t\tcellData = _fnGetCellData( settings, i, j, 'filter' );\n \t\n-\t\t\t\t\t\tcellData = fomatters[ column.sType ] ?\n-\t\t\t\t\t\t\tfomatters[ column.sType ]( cellData ) :\n-\t\t\t\t\t\t\tcellData !== null ?\n-\t\t\t\t\t\t\t\tcellData :\n-\t\t\t\t\t\t\t\t'';\n+\t\t\t\t\t\tif ( fomatters[ column.sType ] ) {\n+\t\t\t\t\t\t\tcellData = fomatters[ column.sType ]( cellData );\n+\t\t\t\t\t\t}\n+\t\n+\t\t\t\t\t\t// Search in DataTables 1.10 is string based. In 1.11 this\n+\t\t\t\t\t\t// should be altered to also allow strict type checking.\n+\t\t\t\t\t\tif ( cellData === null ) {\n+\t\t\t\t\t\t\tcellData = '';\n+\t\t\t\t\t\t}\n+\t\n+\t\t\t\t\t\tif ( typeof cellData !== 'string' && cellData.toString ) {\n+\t\t\t\t\t\t\tcellData = cellData.toString();\n+\t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\telse {\n \t\t\t\t\t\tcellData = '';\n \t\t\t\t\t}\n \t\n-\t\t\t\t\tif ( cellData ) {\n-\t\t\t\t\t\t// If it looks like there is an HTML entity in the string,\n-\t\t\t\t\t\t// attempt to decode it so sorting works as expected. Note that\n-\t\t\t\t\t\t// we could use a single line of jQuery to do this, but the DOM\n-\t\t\t\t\t\t// method used here is much faster http://jsperf.com/html-decode\n-\t\t\t\t\t\tif ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {\n-\t\t\t\t\t\t\t__filter_div.innerHTML = cellData;\n-\t\t\t\t\t\t\tcellData = __filter_div_textContent ?\n-\t\t\t\t\t\t\t\t__filter_div.textContent :\n-\t\t\t\t\t\t\t\t__filter_div.innerText;\n-\t\t\t\t\t\t}\n-\t\n-\t\t\t\t\t\tif ( cellData.replace ) {\n-\t\t\t\t\t\t\tcellData = cellData.replace(/[\\r\\n]/g, '');\n-\t\t\t\t\t\t}\n+\t\t\t\t\t// If it looks like there is an HTML entity in the string,\n+\t\t\t\t\t// attempt to decode it so sorting works as expected. Note that\n+\t\t\t\t\t// we could use a single line of jQuery to do this, but the DOM\n+\t\t\t\t\t// method used here is much faster http://jsperf.com/html-decode\n+\t\t\t\t\tif ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {\n+\t\t\t\t\t\t__filter_div.innerHTML = cellData;\n+\t\t\t\t\t\tcellData = __filter_div_textContent ?\n+\t\t\t\t\t\t\t__filter_div.textContent :\n+\t\t\t\t\t\t\t__filter_div.innerText;\n+\t\t\t\t\t}\n \t\n-\t\t\t\t\t\tfilterData.push( cellData );\n+\t\t\t\t\tif ( cellData.replace ) {\n+\t\t\t\t\t\tcellData = cellData.replace(/[\\r\\n]/g, '');\n \t\t\t\t\t}\n+\t\n+\t\t\t\t\tfilterData.push( cellData );\n \t\t\t\t}\n \t\n \t\t\t\trow._aFilterData = filterData;\n@@ -4162,7 +4196,7 @@\n \t */\n \tfunction _fnThrottle( fn, freq ) {\n \t\tvar\n-\t\t\tfrequency = freq || 200,\n+\t\t\tfrequency = freq !== undefined ? freq : 200,\n \t\t\tlast,\n \t\t\ttimer;\n \t\n@@ -4403,11 +4437,15 @@\n \t\t\t\tiCol = aDataSort[k];\n \t\t\t\tsType = aoColumns[ iCol ].sType || 'string';\n \t\n+\t\t\t\tif ( nestedSort[i]._idx === undefined ) {\n+\t\t\t\t\tnestedSort[i]._idx = $.inArray( nestedSort[i][1], aoColumns[iCol].asSorting );\n+\t\t\t\t}\n+\t\n \t\t\t\taSort.push( {\n \t\t\t\t\tsrc:       srcCol,\n \t\t\t\t\tcol:       iCol,\n \t\t\t\t\tdir:       nestedSort[i][1],\n-\t\t\t\t\tindex:     nestedSort[i][2],\n+\t\t\t\t\tindex:     nestedSort[i]._idx,\n \t\t\t\t\ttype:      sType,\n \t\t\t\t\tformatter: DataTable.ext.type.order[ sType+\"-pre\" ]\n \t\t\t\t} );\n@@ -4610,13 +4648,17 @@\n \t\tvar sorting = settings.aaSorting;\n \t\tvar asSorting = col.asSorting;\n \t\tvar nextSortIdx;\n-\t\tvar next = function ( a ) {\n+\t\tvar next = function ( a, overflow ) {\n \t\t\tvar idx = a._idx;\n \t\t\tif ( idx === undefined ) {\n \t\t\t\tidx = $.inArray( a[1], asSorting );\n \t\t\t}\n \t\n-\t\t\treturn idx+1 >= asSorting.length ? 0 : idx+1;\n+\t\t\treturn idx+1 < asSorting.length ?\n+\t\t\t\tidx+1 :\n+\t\t\t\toverflow ?\n+\t\t\t\t\tnull :\n+\t\t\t\t\t0;\n \t\t};\n \t\n \t\t// Convert to 2D array if needed\n@@ -4631,10 +4673,15 @@\n \t\n \t\t\tif ( sortIdx !== -1 ) {\n \t\t\t\t// Yes, modify the sort\n-\t\t\t\tnextSortIdx = next( sorting[sortIdx] );\n+\t\t\t\tnextSortIdx = next( sorting[sortIdx], true );\n \t\n-\t\t\t\tsorting[sortIdx][1] = asSorting[ nextSortIdx ];\n-\t\t\t\tsorting[sortIdx]._idx = nextSortIdx;\n+\t\t\t\tif ( nextSortIdx === null ) {\n+\t\t\t\t\tsorting.splice( sortIdx, 1 );\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\tsorting[sortIdx][1] = asSorting[ nextSortIdx ];\n+\t\t\t\t\tsorting[sortIdx]._idx = nextSortIdx;\n+\t\t\t\t}\n \t\t\t}\n \t\t\telse {\n \t\t\t\t// No sort on this column yet\n@@ -5113,7 +5160,7 @@\n \t\t\tlen = settings._iDisplayLength;\n \t\n \t\t/* If we have space to show extra rows (backing up from the end point - then do so */\n-\t\tif ( end === settings.fnRecordsDisplay() )\n+\t\tif (start >= end) \n \t\t{\n \t\t\tstart = end - len;\n \t\t}\n@@ -6089,6 +6136,7 @@\n \t\t\t\t\"fnStateLoadCallback\",\n \t\t\t\t\"fnStateSaveCallback\",\n \t\t\t\t\"renderer\",\n+\t\t\t\t\"searchDelay\",\n \t\t\t\t[ \"iCookieDuration\", \"iStateDuration\" ], // backwards compat\n \t\t\t\t[ \"oSearch\", \"oPreviousSearch\" ],\n \t\t\t\t[ \"aoSearchCols\", \"aoPreSearchCols\" ],\n@@ -6719,8 +6767,10 @@\n \t\t\t}\n \t\n \t\t\tfor ( i=0, ien=context.length ; i<ien ; i++ ) {\n+\t\t\t\tvar apiInst = new _Api( context[i] );\n+\t\n \t\t\t\tif ( type === 'table' ) {\n-\t\t\t\t\tret = fn( context[i], i );\n+\t\t\t\t\tret = fn.call( apiInst, context[i], i );\n \t\n \t\t\t\t\tif ( ret !== undefined ) {\n \t\t\t\t\t\ta.push( ret );\n@@ -6728,7 +6778,7 @@\n \t\t\t\t}\n \t\t\t\telse if ( type === 'columns' || type === 'rows' ) {\n \t\t\t\t\t// this has same length as context - one entry for each table\n-\t\t\t\t\tret = fn( context[i], this[i], i );\n+\t\t\t\t\tret = fn.call( apiInst, context[i], this[i], i );\n \t\n \t\t\t\t\tif ( ret !== undefined ) {\n \t\t\t\t\t\ta.push( ret );\n@@ -6747,10 +6797,10 @@\n \t\t\t\t\t\titem = items[j];\n \t\n \t\t\t\t\t\tif ( type === 'cell' ) {\n-\t\t\t\t\t\t\tret = fn( context[i], item.row, item.column, i, j );\n+\t\t\t\t\t\t\tret = fn.call( apiInst, context[i], item.row, item.column, i, j );\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse {\n-\t\t\t\t\t\t\tret = fn( context[i], item, i, j, rows );\n+\t\t\t\t\t\t\tret = fn.call( apiInst, context[i], item, i, j, rows );\n \t\t\t\t\t\t}\n \t\n \t\t\t\t\t\tif ( ret !== undefined ) {\n@@ -7387,11 +7437,12 @@\n \t{\n \t\tvar\n \t\t\tout = [], res,\n-\t\t\ta, i, ien, j, jen;\n+\t\t\ta, i, ien, j, jen,\n+\t\t\tselectorType = typeof selector;\n \t\n \t\t// Can't just check for isArray here, as an API or jQuery instance might be\n \t\t// given with their array like look\n-\t\tif ( ! selector || typeof selector === 'string' || selector.length === undefined ) {\n+\t\tif ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) {\n \t\t\tselector = [ selector ];\n \t\t}\n \t\n@@ -7529,6 +7580,7 @@\n \t{\n \t\treturn _selector_run( selector, function ( sel ) {\n \t\t\tvar selInt = _intVal( sel );\n+\t\t\tvar i, ien;\n \t\n \t\t\t// Short cut - selector is a number and no options provided (default is\n \t\t\t// all records, so no need to check if the index is in there, since it\n@@ -7548,14 +7600,19 @@\n \t\t\t\treturn rows;\n \t\t\t}\n \t\n-\t\t\t// Get nodes in the order from the `rows` array (can't use `pluck`) @todo - use pluck_order\n-\t\t\tvar nodes = [];\n-\t\t\tfor ( var i=0, ien=rows.length ; i<ien ; i++ ) {\n-\t\t\t\tnodes.push( settings.aoData[ rows[i] ].nTr );\n+\t\t\t// Get nodes in the order from the `rows` array\n+\t\t\tvar nodes = _pluck_order( settings.aoData, rows, 'nTr' );\n+\t\n+\t\t\t// Selector - function\n+\t\t\tif ( typeof sel === 'function' ) {\n+\t\t\t\treturn $.map( rows, function (idx) {\n+\t\t\t\t\tvar row = settings.aoData[ idx ];\n+\t\t\t\t\treturn sel( idx, row._aData, row.nTr ) ? idx : null;\n+\t\t\t\t} );\n \t\t\t}\n \t\n+\t\t\t// Selector - node\n \t\t\tif ( sel.nodeName ) {\n-\t\t\t\t// Selector - node\n \t\t\t\tif ( $.inArray( sel, nodes ) !== -1 ) {\n \t\t\t\t\treturn [ sel._DT_RowIndex ];// sel is a TR node that is in the table\n \t\t\t\t\t\t\t\t\t\t\t// and DataTables adds a prop for fast lookup\n@@ -7794,12 +7851,12 @@\n \t};\n \t\n \t\n-\tvar __details_remove = function ( api )\n+\tvar __details_remove = function ( api, idx )\n \t{\n \t\tvar ctx = api.context;\n \t\n-\t\tif ( ctx.length && api.length ) {\n-\t\t\tvar row = ctx[0].aoData[ api[0] ];\n+\t\tif ( ctx.length ) {\n+\t\t\tvar row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ];\n \t\n \t\t\tif ( row._details ) {\n \t\t\t\trow._details.remove();\n@@ -7888,7 +7945,7 @@\n \t\n \t\t\t\tfor ( var i=0, ien=data.length ; i<ien ; i++ ) {\n \t\t\t\t\tif ( data[i]._details ) {\n-\t\t\t\t\t\t__details_remove( data[i] );\n+\t\t\t\t\t\t__details_remove( api, i );\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t} );\n@@ -7983,7 +8040,19 @@\n \t// can be an array of these items, comma separated list, or an array of comma\n \t// separated lists\n \t\n-\tvar __re_column_selector = /^(.*):(name|visIdx|visible)$/;\n+\tvar __re_column_selector = /^(.+):(name|visIdx|visible)$/;\n+\t\n+\t\n+\t// r1 and r2 are redundant - but it means that the parameters match for the\n+\t// iterator callback in columns().data()\n+\tvar __columnData = function ( settings, column, r1, r2, rows ) {\n+\t\tvar a = [];\n+\t\tfor ( var row=0, ien=rows.length ; row<ien ; row++ ) {\n+\t\t\ta.push( _fnGetCellData( settings, rows[row], column ) );\n+\t\t}\n+\t\treturn a;\n+\t};\n+\t\n \t\n \tvar __column_selector = function ( settings, selector, opts )\n \t{\n@@ -7995,63 +8064,74 @@\n \t\treturn _selector_run( selector, function ( s ) {\n \t\t\tvar selInt = _intVal( s );\n \t\n+\t\t\t// Selector - all\n \t\t\tif ( s === '' ) {\n-\t\t\t\t// All columns\n \t\t\t\treturn _range( columns.length );\n \t\t\t}\n-\t\t\telse if ( selInt !== null ) {\n-\t\t\t\t// Integer selector\n+\t\t\t\n+\t\t\t// Selector - index\n+\t\t\tif ( selInt !== null ) {\n \t\t\t\treturn [ selInt >= 0 ?\n \t\t\t\t\tselInt : // Count from left\n \t\t\t\t\tcolumns.length + selInt // Count from right (+ because its a negative value)\n \t\t\t\t];\n \t\t\t}\n-\t\t\telse {\n-\t\t\t\tvar match = typeof s === 'string' ?\n-\t\t\t\t\ts.match( __re_column_selector ) :\n-\t\t\t\t\t'';\n-\t\n-\t\t\t\tif ( match ) {\n-\t\t\t\t\tswitch( match[2] ) {\n-\t\t\t\t\t\tcase 'visIdx':\n-\t\t\t\t\t\tcase 'visible':\n-\t\t\t\t\t\t\tvar idx = parseInt( match[1], 10 );\n-\t\t\t\t\t\t\t// Visible index given, convert to column index\n-\t\t\t\t\t\t\tif ( idx < 0 ) {\n-\t\t\t\t\t\t\t\t// Counting from the right\n-\t\t\t\t\t\t\t\tvar visColumns = $.map( columns, function (col,i) {\n-\t\t\t\t\t\t\t\t\treturn col.bVisible ? i : null;\n-\t\t\t\t\t\t\t\t} );\n-\t\t\t\t\t\t\t\treturn [ visColumns[ visColumns.length + idx ] ];\n-\t\t\t\t\t\t\t}\n-\t\t\t\t\t\t\t// Counting from the left\n-\t\t\t\t\t\t\treturn [ _fnVisibleToColumnIndex( settings, idx ) ];\n+\t\t\t\n+\t\t\t// Selector = function\n+\t\t\tif ( typeof s === 'function' ) {\n+\t\t\t\tvar rows = _selector_row_indexes( settings, opts );\n+\t\n+\t\t\t\treturn $.map( columns, function (col, idx) {\n+\t\t\t\t\treturn s(\n+\t\t\t\t\t\t\tidx,\n+\t\t\t\t\t\t\t__columnData( settings, idx, 0, 0, rows ),\n+\t\t\t\t\t\t\tnodes[ idx ]\n+\t\t\t\t\t\t) ? idx : null;\n+\t\t\t\t} );\n+\t\t\t}\n \t\n-\t\t\t\t\t\tcase 'name':\n-\t\t\t\t\t\t\t// match by name. `names` is column index complete and in order\n-\t\t\t\t\t\t\treturn $.map( names, function (name, i) {\n-\t\t\t\t\t\t\t\treturn name === match[1] ? i : null;\n+\t\t\t// jQuery or string selector\n+\t\t\tvar match = typeof s === 'string' ?\n+\t\t\t\ts.match( __re_column_selector ) :\n+\t\t\t\t'';\n+\t\n+\t\t\tif ( match ) {\n+\t\t\t\tswitch( match[2] ) {\n+\t\t\t\t\tcase 'visIdx':\n+\t\t\t\t\tcase 'visible':\n+\t\t\t\t\t\tvar idx = parseInt( match[1], 10 );\n+\t\t\t\t\t\t// Visible index given, convert to column index\n+\t\t\t\t\t\tif ( idx < 0 ) {\n+\t\t\t\t\t\t\t// Counting from the right\n+\t\t\t\t\t\t\tvar visColumns = $.map( columns, function (col,i) {\n+\t\t\t\t\t\t\t\treturn col.bVisible ? i : null;\n \t\t\t\t\t\t\t} );\n-\t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t\telse {\n-\t\t\t\t\t// jQuery selector on the TH elements for the columns\n-\t\t\t\t\treturn $( nodes )\n-\t\t\t\t\t\t.filter( s )\n-\t\t\t\t\t\t.map( function () {\n-\t\t\t\t\t\t\treturn $.inArray( this, nodes ); // `nodes` is column index complete and in order\n-\t\t\t\t\t\t} )\n-\t\t\t\t\t\t.toArray();\n+\t\t\t\t\t\t\treturn [ visColumns[ visColumns.length + idx ] ];\n+\t\t\t\t\t\t}\n+\t\t\t\t\t\t// Counting from the left\n+\t\t\t\t\t\treturn [ _fnVisibleToColumnIndex( settings, idx ) ];\n+\t\n+\t\t\t\t\tcase 'name':\n+\t\t\t\t\t\t// match by name. `names` is column index complete and in order\n+\t\t\t\t\t\treturn $.map( names, function (name, i) {\n+\t\t\t\t\t\t\treturn name === match[1] ? i : null;\n+\t\t\t\t\t\t} );\n \t\t\t\t}\n \t\t\t}\n+\t\t\telse {\n+\t\t\t\t// jQuery selector on the TH elements for the columns\n+\t\t\t\treturn $( nodes )\n+\t\t\t\t\t.filter( s )\n+\t\t\t\t\t.map( function () {\n+\t\t\t\t\t\treturn $.inArray( this, nodes ); // `nodes` is column index complete and in order\n+\t\t\t\t\t} )\n+\t\t\t\t\t.toArray();\n+\t\t\t}\n \t\t} );\n \t};\n \t\n \t\n-\t\n-\t\n-\t\n-\tvar __setColumnVis = function ( settings, column, vis ) {\n+\tvar __setColumnVis = function ( settings, column, vis, recalc ) {\n \t\tvar\n \t\t\tcols = settings.aoColumns,\n \t\t\tcol  = cols[ column ],\n@@ -8094,12 +8174,14 @@\n \t\t_fnDrawHead( settings, settings.aoHeader );\n \t\t_fnDrawHead( settings, settings.aoFooter );\n \t\n-\t\t// Automatically adjust column sizing\n-\t\t_fnAdjustColumnSizing( settings );\n+\t\tif ( recalc === undefined || recalc ) {\n+\t\t\t// Automatically adjust column sizing\n+\t\t\t_fnAdjustColumnSizing( settings );\n \t\n-\t\t// Realign columns for scrolling\n-\t\tif ( settings.oScroll.sX || settings.oScroll.sY ) {\n-\t\t\t_fnScrollDraw( settings );\n+\t\t\t// Realign columns for scrolling\n+\t\t\tif ( settings.oScroll.sX || settings.oScroll.sY ) {\n+\t\t\t\t_fnScrollDraw( settings );\n+\t\t\t}\n \t\t}\n \t\n \t\t_fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis] );\n@@ -8159,12 +8241,13 @@\n \t *\n \t */\n \t_api_registerPlural( 'columns().data()', 'column().data()', function () {\n-\t\treturn this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {\n-\t\t\tvar a = [];\n-\t\t\tfor ( var row=0, ien=rows.length ; row<ien ; row++ ) {\n-\t\t\t\ta.push( _fnGetCellData( settings, rows[row], column, '' ) );\n-\t\t\t}\n-\t\t\treturn a;\n+\t\treturn this.iterator( 'column-rows', __columnData );\n+\t} );\n+\t\n+\t\n+\t_api_registerPlural( 'columns().dataSrc()', 'column().dataSrc()', function () {\n+\t\treturn this.iterator( 'column', function ( settings, column ) {\n+\t\t\treturn settings.aoColumns[column].mData;\n \t\t} );\n \t} );\n \t\n@@ -8186,11 +8269,11 @@\n \t\n \t\n \t\n-\t_api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis ) {\n+\t_api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) {\n \t\treturn this.iterator( 'column', function ( settings, column ) {\n \t\t\treturn vis === undefined ?\n \t\t\t\tsettings.aoColumns[ column ].bVisible :\n-\t\t\t\t__setColumnVis( settings, column, vis );\n+\t\t\t\t__setColumnVis( settings, column, vis, calc );\n \t\t} );\n \t} );\n \t\n@@ -8255,31 +8338,48 @@\n \t\tvar allCells = $( [].concat.apply([], cells) );\n \t\tvar row;\n \t\tvar columns = settings.aoColumns.length;\n-\t\tvar a, i, ien, j;\n+\t\tvar a, i, ien, j, o, host;\n \t\n \t\treturn _selector_run( selector, function ( s ) {\n-\t\t\tif ( s === null || s === undefined ) {\n-\t\t\t\t// All cells\n+\t\t\tvar fnSelector = typeof s === 'function';\n+\t\n+\t\t\tif ( s === null || s === undefined || fnSelector ) {\n+\t\t\t\t// All cells and function selectors\n \t\t\t\ta = [];\n \t\n \t\t\t\tfor ( i=0, ien=rows.length ; i<ien ; i++ ) {\n \t\t\t\t\trow = rows[i];\n \t\n \t\t\t\t\tfor ( j=0 ; j<columns ; j++ ) {\n-\t\t\t\t\t\ta.push( {\n+\t\t\t\t\t\to = {\n \t\t\t\t\t\t\trow: row,\n \t\t\t\t\t\t\tcolumn: j\n-\t\t\t\t\t\t} );\n+\t\t\t\t\t\t};\n+\t\n+\t\t\t\t\t\tif ( fnSelector ) {\n+\t\t\t\t\t\t\t// Selector - function\n+\t\t\t\t\t\t\thost = settings.aoData[ row ];\n+\t\n+\t\t\t\t\t\t\tif ( s( o, _fnGetCellData(settings, row, j), host.anCells[j] ) ) {\n+\t\t\t\t\t\t\t\ta.push( o );\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\t}\n+\t\t\t\t\t\telse {\n+\t\t\t\t\t\t\t// Selector - all\n+\t\t\t\t\t\t\ta.push( o );\n+\t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\n \t\t\t\treturn a;\n \t\t\t}\n-\t\t\telse if ( $.isPlainObject( s ) ) {\n+\t\t\t\n+\t\t\t// Selector - index\n+\t\t\tif ( $.isPlainObject( s ) ) {\n \t\t\t\treturn [s];\n \t\t\t}\n \t\n-\t\t\t// jQuery filtered cells\n+\t\t\t// Selector - jQuery filtered cells\n \t\t\treturn allCells\n \t\t\t\t.filter( s )\n \t\t\t\t.map( function (i, el) {\n@@ -8375,6 +8475,13 @@\n \t} );\n \t\n \t\n+\t_api_registerPlural( 'cells().render()', 'cell().render()', function ( type ) {\n+\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n+\t\t\treturn _fnGetCellData( settings, row, column, type );\n+\t\t} );\n+\t} );\n+\t\n+\t\n \t_api_registerPlural( 'cells().indexes()', 'cell().index()', function () {\n \t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n \t\t\treturn {\n@@ -8547,33 +8654,34 @@\n \t} );\n \t\n \t\n-\t_api_register( [\n+\t_api_registerPlural(\n \t\t'columns().search()',\n-\t\t'column().search()'\n-\t], function ( input, regex, smart, caseInsen ) {\n-\t\treturn this.iterator( 'column', function ( settings, column ) {\n-\t\t\tvar preSearch = settings.aoPreSearchCols;\n+\t\t'column().search()',\n+\t\tfunction ( input, regex, smart, caseInsen ) {\n+\t\t\treturn this.iterator( 'column', function ( settings, column ) {\n+\t\t\t\tvar preSearch = settings.aoPreSearchCols;\n+\t\n+\t\t\t\tif ( input === undefined ) {\n+\t\t\t\t\t// get\n+\t\t\t\t\treturn preSearch[ column ].sSearch;\n+\t\t\t\t}\n \t\n-\t\t\tif ( input === undefined ) {\n-\t\t\t\t// get\n-\t\t\t\treturn preSearch[ column ].sSearch;\n-\t\t\t}\n+\t\t\t\t// set\n+\t\t\t\tif ( ! settings.oFeatures.bFilter ) {\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n \t\n-\t\t\t// set\n-\t\t\tif ( ! settings.oFeatures.bFilter ) {\n-\t\t\t\treturn;\n-\t\t\t}\n+\t\t\t\t$.extend( preSearch[ column ], {\n+\t\t\t\t\t\"sSearch\": input+\"\",\n+\t\t\t\t\t\"bRegex\":  regex === null ? false : regex,\n+\t\t\t\t\t\"bSmart\":  smart === null ? true  : smart,\n+\t\t\t\t\t\"bCaseInsensitive\": caseInsen === null ? true : caseInsen\n+\t\t\t\t} );\n \t\n-\t\t\t$.extend( preSearch[ column ], {\n-\t\t\t\t\"sSearch\": input+\"\",\n-\t\t\t\t\"bRegex\":  regex === null ? false : regex,\n-\t\t\t\t\"bSmart\":  smart === null ? true  : smart,\n-\t\t\t\t\"bCaseInsensitive\": caseInsen === null ? true : caseInsen\n+\t\t\t\t_fnFilterComplete( settings, settings.oPreviousSearch, 1 );\n \t\t\t} );\n-\t\n-\t\t\t_fnFilterComplete( settings, settings.oPreviousSearch, 1 );\n-\t\t} );\n-\t} );\n+\t\t}\n+\t);\n \t\n \t/*\n \t * State API methods\n@@ -8704,6 +8812,29 @@\n \t\n \t\n \t/**\n+\t * DataTables utility methods\n+\t * \n+\t * This namespace provides helper methods that DataTables uses internally to\n+\t * create a DataTable, but which are not exclusively used only for DataTables.\n+\t * These methods can be used by extension authors to save the duplication of\n+\t * code.\n+\t *\n+\t *  @namespace\n+\t */\n+\tDataTable.util = {\n+\t\t/**\n+\t\t * Throttle the calls to a function. Arguments and context are maintained\n+\t\t * for the throttled function.\n+\t\t *\n+\t\t * @param {function} fn Function to be called\n+\t\t * @param {integer} freq Call frequency in mS\n+\t\t * @return {function} Wrapped function\n+\t\t */\n+\t\tthrottle: _fnThrottle\n+\t};\n+\t\n+\t\n+\t/**\n \t * Convert from camel case parameters to Hungarian notation. This is made public\n \t * for the extensions to provide the same ability as DataTables core to accept\n \t * either the 1.9 style Hungarian notation, or the 1.10+ style camelCase\n@@ -8882,7 +9013,7 @@\n \t *  @type string\n \t *  @default Version number\n \t */\n-\tDataTable.version = \"1.10.1\";\n+\tDataTable.version = \"1.10.3\";\n \n \t/**\n \t * Private data store, containing all of the settings objects that are\n@@ -11323,6 +11454,26 @@\n \t\n \t\n \t\t/**\n+\t\t * Search delay option. This will throttle full table searches that use the\n+\t\t * DataTables provided search input element (it does not effect calls to\n+\t\t * `dt-api search()`, providing a delay before the search is made.\n+\t\t *  @type integer\n+\t\t *  @default 0\n+\t\t *\n+\t\t *  @dtopt Options\n+\t\t *  @name DataTable.defaults.searchDelay\n+\t\t *\n+\t\t *  @example\n+\t\t *    $(document).ready( function() {\n+\t\t *      $('#example').dataTable( {\n+\t\t *        \"searchDelay\": 200\n+\t\t *      } );\n+\t\t *    } )\n+\t\t */\n+\t\t\"searchDelay\": null,\n+\t\n+\t\n+\t\t/**\n \t\t * DataTables features four different built-in options for the buttons to\n \t\t * display for pagination control:\n \t\t *\n@@ -12839,6 +12990,13 @@\n \t\t\"sDom\": null,\n \t\n \t\t/**\n+\t\t * Search delay (in mS)\n+\t\t *  @type integer\n+\t\t *  @default null\n+\t\t */\n+\t\t\"searchDelay\": null,\n+\t\n+\t\t/**\n \t\t * Which type of pagination should be used.\n \t\t * Note that this parameter will be set by the initialisation routine. To\n \t\t * set a default use {@link DataTable.defaults}.\n@@ -13987,7 +14145,7 @@\n \t\n \t\n \tvar __numericReplace = function ( d, decimalPlace, re1, re2 ) {\n-\t\tif ( !d || d === '-' ) {\n+\t\tif ( d !== 0 && (!d || d === '-') ) {\n \t\t\treturn -Infinity;\n \t\t}\n \t\n@@ -14107,7 +14265,7 @@\n \t\t\t// V8 will remove any unknown characters at the start and end of the\n \t\t\t// expression, leading to false matches such as `$245.12` or `10%` being\n \t\t\t// a valid date. See forum thread 18941 for detail.\n-\t\t\tif ( d && ( ! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {\n+\t\t\tif ( d && !(d instanceof Date) && ( ! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {\n \t\t\t\treturn null;\n \t\t\t}\n \t\t\tvar parsed = Date.parse(d);\n@@ -14201,8 +14359,6 @@\n \t\t\t},\n \t\n \t\t\tjqueryui: function ( settings, cell, column, classes ) {\n-\t\t\t\tvar colIdx = column.idx;\n-\t\n \t\t\t\t$('<div/>')\n \t\t\t\t\t.addClass( classes.sSortJUIWrapper )\n \t\t\t\t\t.append( cell.contents() )\n@@ -14217,6 +14373,8 @@\n \t\t\t\t\t\treturn;\n \t\t\t\t\t}\n \t\n+\t\t\t\t\tvar colIdx = column.idx;\n+\t\n \t\t\t\t\tcell\n \t\t\t\t\t\t.removeClass( classes.sSortAsc +\" \"+classes.sSortDesc )\n \t\t\t\t\t\t.addClass( columns[ colIdx ] == 'asc' ?\n@@ -14610,3 +14768,4 @@\n }));\n \n }(window, document));\n+\n"},{"id":"250663","messageId":"CAEemfuUNEEkgaX+ek0N1_801Zu=g6AizABmzAakpkosx93A_eQ@mail.gmail.com","threadId":"37731","inReplyTo":"CAEemfuW5k+2r7TpetUK8dh5vLZBR4-Kc1JgYJhG-RPpoQTRQ3Q@mail.gmail.com","subject":"Re: Expected bug with reset --hard","fromName":"Nicholas Chmielewski","fromEmail":"nicholas.chmielewski@ennova.com.au","sentAt":"2014-10-15T05:47:51Z","receivedAt":"2014-10-15T05:47:51Z","isPatch":false,"sender":{"key":"nicholas.chmielewski@ennova.com.au","avatar":null},"body":"I'd like to rescind my bug report.\n\n\nA bit more further investigation revealed that git was detecting the\nfile with changes as jquery.datatables.js but the file in my directory\nwas reported as being named jquery.dataTables.js .\n\nI'm currently working on OS X 10.9, and this issue is probably related\nmore to the case-preservation of the file system rather than git\nitself.\n\nOn 15 October 2014 14:34, Nicholas Chmielewski\n<nicholas.chmielewski@ennova.com.au> wrote:\n> git version 1.9.1 & version 2.1.2\n>\n> I had some changes in a tracked file that I wanted to discard.\n> Instead of using checkout, I instead used `git reset --hard HEAD` to reset.\n>\n> Git returned the message `HEAD is now at <sha> <commit-message>`\n> I then went `git status` and it showed me that I still have changes to commit\n>\n> I expected there to be no changes in my working directory as a result of\n> doing a `git reset --hard`\n>\n> I did a little more fiddling around and still yielded the same results.\n>\n> - `$ touch file.md`\n> - `$ git add file.md`\n> - `$ git commit -m 'empty file'`\n> - `$ echo 'text' > file.md`\n>\n> At this point git reported that I had uncommited changes for both file.md and\n> the troublesome file in question (jquery.datatables.js)\n>\n> `$ git reset --hard HEAD`\n>\n> Git now no longer reports and untracked changes for file.md but still\n> for jquery.datatables.js\n>\n> `$ git reset --hard HEAD~1`\n>\n> Git still reports untracked changes for jquery.datatables.js\n>\n> I have included a copy of the diff of the jquery.datatables.js\n"}]}